<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 5rem;
            height: 0.463rem;
            background-color: rebeccapurple;
        }
    </style>
</head>
<body>
    <div>
        <!--

             1rem=16px
             html.fontsize=12px
             px,%,rem 所谓rem 就是相对于根元素（HTML）的fontsize
        

         -->
    </div>
    <script>
        var width=window.innerWidth;
        var html=document.getElementsByTagName("html")[0];
        html.style.fontSize=width/10+"px";
        Window.onresize=function(){
            var width=document.documentElement.clientWidth;
            html.style.fontSize=width/10+"px";
        }
    </script>
</body>
</html>